<include file="Public:header" />
<div class="page-member subpage">
    <div class="form-header">
        <div>
            <div class="line1">
                <div class="fl"><h3>焦点政务详情 / {$affairsFocus.title}</h3></div>
                <div class="fr hidden">
                    <form class="search-form" method="post" action="">
                        <input name="field" value="{$context.field}" type="hidden" />
                        <input name="value" value="{$context.value}" type="hidden" />
                        <input name="page" value="{$context.page}" type="hidden" />
                        <input name="order_field" value="{$context.order_field}" type="hidden" />
                        <input name="order_sort" value="{$context.order_sort}" type="hidden" />
                        <input name="offset" value="{$context.offset}" type="hidden" />
                        <input name="id" value="{$context.id}" type="hidden" />
                    </form>
                </div>
            </div>
            <div class="line2">
                <!-- 编辑按钮组 -->
                <div class="fl form-btn-group btn-group-edit">
                    <in name="$x|default='03-01-12'" value="$rightsCode">
                        <button onclick="action_edit();" class="btn-save btn-highlight">编 辑</button>
                        <else />
                        <button disabled="disabled" class="btn-save btn-disable">编 辑</button>
                    </in>
                    <span>或</span>
                    <a class="linkBtn btn-abort" href="/admin/affairsFocus/add">创建</a>
                </div>
                <!-- 保存按钮组 -->
                <div class="fl form-btn-group btn-group-save hidden">
                    <button onclick="action_save();" class="btn-save btn-highlight">保 存</button>
                    <span>或</span>
                    <a class="linkBtn btn-abort" onclick="action_abort();" href="javascript:void(0);">放弃</a>
                </div>
                <div class="fl form-btn-more">
                    <button class="btn-normal btn-more">
                        更多操作<i class="drop-down"></i>
                    </button>
                    <ul class="more-action hidden">
                        <in name="$x|default='03-01-12'" value="$rightsCode">
                            <li><a onclick="action_del2();" href="javascript:void(0);">删 除</a></li>
                        </in>
                    </ul>
                </div>
                <div class="fr form-search-count">
                    <span class="index">{$context.index}/{$page.total}</span>
                    <button onclick="ItemJump({$page.prev.id}, {$page.prev.offset});" class="btn-normal">上一条</button>
                    <button onclick="ItemJump({$page.next.id}, {$page.next.offset});" class="btn-normal">下一条</button>
                </div>
            </div>
        </div>
    </div>
    <div class="form-box2">
        <div>
            <form id="affairsFocusForm" method="post" action="">
                <!--表单相关原始信息存储-->
                <input type="hidden" name="old_seq" value="{$affairsFocus.seq}" />
                <input type="hidden" name="old_photo" value="{$affairsFocus.photo}" />
                <input type="hidden" name="old_active" value="{$affairsFocus.active}" />
                <input type="hidden" name="old_title" value="{$affairsFocus.title}" />
                <input name="photo" value="{$affairsFocus.photo}" type="hidden" />
                <input name="upload" class="hidden" type="file" />
                <input name="model" value="read" type="hidden" />
                <table class="form">
                    <tr>
                        <th width="20%">政务内容标题<span class="hint">*</span></th>
                        <td width="30%" field="title">{$affairsFocus.title}</td>
                        <th width="20%">序号<span class="hint">*</span></th>
                        <td field="seq">{$affairsFocus.seq}</td>
                    </tr>
                    <tr>
                        <th>缩略图<span class="hint">*</span></th>
                        <td field="photo">
                            <img name="photo" style="height: 120px;width:150px;" class="img-upload" src="{$affairsFocus.photo|default='__IMG__/index/thumb.png'}" />
                        </td>
                        <th>是否有效？<span class="hint">*</span></th>
                        <td field="active">
                            <if condition="$affairsFocus.active eq '有效'">
                                <input name="active" type="checkbox" checked="checked" disabled="disabled" />
                                <else />
                                <input name="active" type="checkbox" disabled="disabled" />
                            </if>
                        </td>
                    </tr>
                    <tr>
                        <th>操作人</th>
                        <td field="cuser">{$affairsFocus.cuser}</td>
                        <th>操作时间</th>
                        <td field="ctime">{$affairsFocus.ctime}</td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<link type="text/css" href="__JS__/autocomplete2/src/jquery.autocomplete.min.css" rel="stylesheet">
<script src="__JS__/autocomplete2/src/jquery.autocomplete.js" type="text/javascript"></script>
<script>

    $(document).ready(function(){
        $(".img-upload").click(function () {
            if($("input[name=model]").val()=='EDIT'){
                $("input[name=upload]").prop("mb", $(this).prop("name")).click();
            }
        });
        $("input[name=upload]").change(function () {
            var self = $(this);
            var form_data = new FormData();
            var file_data = self.prop('files')[0];
            form_data.append('file', file_data);
            $.ajax({
                url: '/home/index/ajax_UploadImg',
                dataType: 'json',
                contentType: false,
                processData: false,
                data: form_data,
                type: 'post',
                success: function(res){
                    if(res.status){
                        self.val(""); //重置文件上传框
                        $("img[name="+self.prop("mb")+"]").prop("src", res.info);
                        $("input[name="+self.prop("mb")+"]").val(res.info);
                    }else{
                        alert(res.info);
                    }
                }
            });
        });
    });
</script>
<script src="__JS__/affairsFocus.js?v=0.1" type="text/javascript" ></script>
<include file="Public:footer" />
